<?php
/**
 * WB_IdentifierPDO class
 * 
 * @author Jean-Lou Dupont
 * @version @@package-version@@
 * @id $Id: IdentifierPDO.php 167 2008-03-31 02:34:04Z jldupont $
 */

 //{{include
 require 'web-bloks/Identifier/Identifier.php';
 //include}}
 
 class WB_IdentifierPDO
 	extends WB_Identifier
 {
 	/**
 	 * Constructor
 	 */
	public function __construct( $params = null )
	{
		parent::__construct( $params );
	}
		
	// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%		
	// Interface
	// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	/**
	 * Validation
	 * 
	 * @see WB_Identifier::validate
	 * @return $result Boolean
	 */
	public function validate()
	{
		$id = $this->get();
		
		// first, we can't allow single nor double quotes
		if ( strpos( $id, "'" ) !== false )
			return false;

		if ( strpos( $id, '"' ) !== false )
			return false;
			
		// second, make sure we don't go over 255 characters
		if ( strlen( $id) > 255 )
			return false;
			
		return true;
	}
	
 } // end class declaration